Learning Objectives

After completing this lesson, you’ll be able to:

In this lesson, you will:

Learning Objectives

After completing this lesson, you’ll be able to:

In this lesson, you will:

Resources

Geographic Area of Interest

Some self-serve spatial workflows benefit from allowing users to choose the geographic area of interest for data download. There are three ways of doing so with FME:

Note

Generally, the bounding box option is tedious and the most restrictive. The user must manually enter four bounding coordinates.
The ad hoc or existing boundaries are more versatile and user-friendly. 

Geometry Parameter Interactive Web Map

You create the ad hoc boundary option using a spatial geometry user parameter, which you link to create a feature in the workspace. This parameter lets you draw a point or an area of interest to input into a workspace on FME Flow. 

When configuring a workspace to run on FME Flow containing a geometry user parameter, you, or your end users, access a web map from the Run Workspace page to create the geometry feature - a point, line, polygon, or rectangle. When you draw a polygon, close the shape by clicking the starting point. 

You can access the web map inline under User Parameters...

... or as a pop-up web map. 

You may collapse the pop-up map by clicking and expand the menu in the inline mapfor the option to pop it out into its own window. 

Note

For more information on the geometry parameter and setting custom basemaps for the web map in FME Flow, please see Using the Geometry Parameter.

Exercise

Jennifer continues to update workspaces to use user parameters, giving end users greater control over how the workspace operates. This time, she is responsible for managing a workflow to mail construction alerts to residents who may be affected by noise from City construction work. Normally, someone would manually generate the list of affected residents. However, Jennifer wants to let the construction teams create the list to save valuable time.

So far, Jennifer has a workspace that generates the list of affected residents and allows users to choose the format for their data download. Now, she needs to add a user parameter that allows users to select and enter their area of interest interactively.

For this exercise, follow the steps below to help Jennifer configure a geometry user parameter to take spatial input. 

1) Open Workspace

Open the starting workspace (C:\FMEData\Workspaces\DeployWorkflowsWithFMEFlow\get-geometry-input-from-users.fmw) in FME Workbench.

The workspace reads in Addresses, clips them to a buffered geometry input, and writes the clipped Address data in the user's choice format. The GeometryReplacer transformer is incomplete; it's missing input geometry, which you will remedy once you create the geometry user parameter. 

2) Open User Parameters

The workspace already has a user parameter that lets users choose the output format of the clipped Addresses. Right-click User Parameters in the Navigator and select Manage User Parameters...

The Output Format parameter limits the format options to specific formats. It appears to the user as a drop-down selection, with the default format set to Microsoft Excel. 

3) Create a Geometry Parameter

Next, add a spatial user parameter to take a construction area as input from the user. Click the green + icon in the top-left. Select Spatial > Define Geometry.

Configure it with the following options:

Parameter Identifier GEOM_COORDS
Label Select Construction Area
Required Checked
Show Label Checked
Visibility Always Show

For Geometry Configuration, set the following and leave anything else as default:

Geometry Encoding GeoJSON
Geometry Types Polygon, Box, Line
Specify initial bounds for map display Checked
Top (-90..90) 49.2548
Left (-180..180) -123.244
Bottom (-90..90) 49.3034
Right (-180..180) -123.071

The initial bounds will be the area shown in FME Flow when the user opens the geometry parameter map. Larger bounds will have the map zoomed out, and smaller bounds will have the map zoomed in. Your geometry parameter configuration should look like this: 

Reorder the parameters so the new geometry parameter appears at the top of the list, then click OK to close the Parameter Manager.

4) Link the Geometry Parameter

Now that you've set up the geometry user parameter, you need to link it within the workflow. 

Open the GeometryReplacer parameters. Ensure the Geometry Encoding is GeoJSON and then set the Geometry Source to the GEOM_COORDS parameter.

The GeometryReplacer uses the user parameter input to ensure the user's desired geometry clips the Addresses. Click OK to close the GeometryReplacer Parameters. 

5) Test Writing Results to Shapefile

Now test the workspace results before deploying it on FME Flow. Click Run to run the workspace. In the translation parameters prompt, select Esri Shapefile as the output format. 

For the Geometry parameter, you must supply GeoJSON to run and test on FME Workbench. FME Flow offers the advantage of an interactive web map. For now, paste the following GeoJSON code to test the parameter:

{"type":"Polygon","coordinates":[[[-123.131762,49.282752],[-123.132148,49.282465],[-123.131579,49.282087],[-123.131139,49.282332],[-123.131762,49.282752]]]}



Click Run and wait for the translation to finish. Then click the NotifyList writer feature type and click View Written Data

Add NotifyList.shp to the end of the Dataset parameter path and click OK

The addresses to notify, those within 100m of the area of interest you input, appear in the Data Preview window.

Note

We have provided GeoJSON code for testing the Geometry parameter. If you want to get your own GeoJSON to test, you can publish your unfinished workspace to FME Flow, fill out the Geometry parameter, and copy the resulting GeoJSON code. Alternatively, you can use an online service to generate the GeoJSON for you, e.g. https://geojson.io/. Just remember the parameter expects a single feature.

6) Publish to FME Flow

With the workspace complete, publish the workspace to FME Flow. Select the Training repository and set Data Download and Job Submitter as the services.

Publish to FME Flow
Once you build your workflows in FME Workbench, you need to transfer them to FME Flow through the publishing process. To publish a workspace to FME Flow, you need to complete all the steps in the publishing wizard.  
1. Click Publish in the FME Flow Connection toolbar. The publishing wizard window will open.
2. Confirm your FME Flow Connection lists the correct connection and successfully connects to your FME Flow.
3. Select a repository to house the workspace on FME Flow from the drop-down options. To create a new repository, click New and enter its details. 
4. Optionally, you may Upload data files to publish the workspace's source data files to FME Flow along with the workspace. You can control which files to upload from the Select Files... option. 
5. Click Next to move on to the next step.
6. If your workspace uses any connections, the Upload Connections section will appear. You can select whether to publish the connections to FME Flow. 
7. Register Services is the last publishing step. Select the transformation services you want your workspace to be able to use on FME Flow. 
8. Click Publish
9. The translation log generates a summary of publishing and provides a direct link to open the workspace on FME Flow. 
For more information on the FME Flow services and publishing to FME Flow, see Deploy Workspaces on FME Flow

7) Run Workspace on FME Flow

Open the Run Workspace page on FME Flow and select the workspace you just published. Set the service to Data Download. The result will contain the list of addresses to notify about construction in the format of your choice. 

Under User Parameters, click the map icon for the Select Construction Area parameter. 

The geometry parameter web map appears. It shows the area specified in the user parameter settings in FME Workbench and offers options along the top to select which geometry type you wish to input.

Zoom into an area like downtown Vancouver, use the polygon tool to pick an area, and click Confirm to close the map. 

Note

To close an area in a polygon, click on the starting point to complete the shape.
For this workspace to run correctly, you need to select buildings with addresses. If you select an area without an address the workspace won’t write out any data. 

Confirm that GeoJSON coordinates are now present in the Select Construction Area parameter, and leave Microsoft Excel as the default output format. 

Click Run to run the workspace and wait for the Data Download URL. 

 8) Inspect Results

Once the workspace finishes running, click on the Data Download URL to download the data. 

Optionally, extract and open the data in FME Data Inspector. Now, Jennifer and her colleagues can use this workspace to generate a list of residents affected by the construction and send letters to them.

Viewing the resulting addresses in Microsoft Excel

Resources

Geographic Area of Interest

Some self-serve spatial workflows benefit from allowing users to choose the geographic area of interest for data download. There are three ways of doing so with FME:

Note

Generally, the bounding box option is tedious and the most restrictive. The user must manually enter four bounding coordinates.
The ad hoc or existing boundaries are more versatile and user-friendly. 

Geometry Parameter Interactive Web Map

You create the ad hoc boundary option using a spatial geometry user parameter, which you link to create a feature in the workspace. This parameter lets you draw a point or an area of interest to input into a workspace on FME Flow. 

When configuring a workspace to run on FME Flow containing a geometry user parameter, you, or your end users, access a web map from the Run Workspace page to create the geometry feature - a point, line, polygon, or rectangle. When you draw a polygon, close the shape by clicking the starting point. 

You can access the web map inline under User Parameters...

... or as a pop-up web map. 

You may collapse the pop-up map by clicking and expand the menu in the inline mapfor the option to pop it out into its own window. 

Note

For more information on the geometry parameter and setting custom basemaps for the web map in FME Flow, please see Using the Geometry Parameter.

Exercise

Jennifer continues to update workspaces to use user parameters, giving end users greater control over how the workspace operates. This time, she is responsible for managing a workflow to mail construction alerts to residents who may be affected by noise from City construction work. Normally, someone would manually generate the list of affected residents. However, Jennifer wants to let the construction teams create the list to save valuable time.

So far, Jennifer has a workspace that generates the list of affected residents and allows users to choose the format for their data download. Now, she needs to add a user parameter that allows users to select and enter their area of interest interactively.

For this exercise, follow the steps below to help Jennifer configure a geometry user parameter to take spatial input. 

1) Open Workspace

Open the starting workspace (C:\FMEData\Workspaces\DeployWorkflowsWithFMEFlow\get-geometry-input-from-users.fmw) in FME Workbench.

The workspace reads in Addresses, clips them to a buffered geometry input, and writes the clipped Address data in the user's choice format. The GeometryReplacer transformer is incomplete; it's missing input geometry, which you will remedy once you create the geometry user parameter. 

2) Open User Parameters

The workspace already has a user parameter that lets users choose the output format of the clipped Addresses. Right-click User Parameters in the Navigator and select Manage User Parameters...

The Output Format parameter limits the format options to specific formats. It appears to the user as a drop-down selection, with the default format set to Microsoft Excel. 

3) Create a Geometry Parameter

Next, add a spatial user parameter to take a construction area as input from the user. Click the green + icon in the top-left. Select Spatial > Define Geometry.

Configure it with the following options:

Parameter Identifier GEOM_COORDS
Label Select Construction Area
Required Checked
Show Label Checked
Visibility Always Show

For Geometry Configuration, set the following and leave anything else as default:

Geometry Encoding GeoJSON
Geometry Types Polygon, Box, Line
Specify initial bounds for map display Checked
Top (-90..90) 49.2548
Left (-180..180) -123.244
Bottom (-90..90) 49.3034
Right (-180..180) -123.071

The initial bounds will be the area shown in FME Flow when the user opens the geometry parameter map. Larger bounds will have the map zoomed out, and smaller bounds will have the map zoomed in. Your geometry parameter configuration should look like this: 

Reorder the parameters so the new geometry parameter appears at the top of the list, then click OK to close the Parameter Manager.

4) Link the Geometry Parameter

Now that you've set up the geometry user parameter, you need to link it within the workflow. 

Open the GeometryReplacer parameters. Ensure the Geometry Encoding is GeoJSON and then set the Geometry Source to the GEOM_COORDS parameter.

The GeometryReplacer uses the user parameter input to ensure the user's desired geometry clips the Addresses. Click OK to close the GeometryReplacer Parameters. 

5) Test Writing Results to Shapefile

Now test the workspace results before deploying it on FME Flow. Click Run to run the workspace. In the translation parameters prompt, select Esri Shapefile as the output format. 

For the Geometry parameter, you must supply GeoJSON to run and test on FME Workbench. FME Flow offers the advantage of an interactive web map. For now, paste the following GeoJSON code to test the parameter:

{"type":"Polygon","coordinates":[[[-123.131762,49.282752],[-123.132148,49.282465],[-123.131579,49.282087],[-123.131139,49.282332],[-123.131762,49.282752]]]}



Click Run and wait for the translation to finish. Then click the NotifyList writer feature type and click View Written Data

Add NotifyList.shp to the end of the Dataset parameter path and click OK

The addresses to notify, those within 100m of the area of interest you input, appear in the Data Preview window.

Note

We have provided GeoJSON code for testing the Geometry parameter. If you want to get your own GeoJSON to test, you can publish your unfinished workspace to FME Flow, fill out the Geometry parameter, and copy the resulting GeoJSON code. Alternatively, you can use an online service to generate the GeoJSON for you, e.g. https://geojson.io/. Just remember the parameter expects a single feature.

6) Publish to FME Flow

With the workspace complete, publish the workspace to FME Flow. Select the Training repository and set Data Download and Job Submitter as the services.

Publish to FME Flow
Once you build your workflows in FME Workbench, you need to transfer them to FME Flow through the publishing process. To publish a workspace to FME Flow, you need to complete all the steps in the publishing wizard.  
1. Click Publish in the FME Flow Connection toolbar. The publishing wizard window will open.
2. Confirm your FME Flow Connection lists the correct connection and successfully connects to your FME Flow.
3. Select a repository to house the workspace on FME Flow from the drop-down options. To create a new repository, click New and enter its details. 
4. Optionally, you may Upload data files to publish the workspace's source data files to FME Flow along with the workspace. You can control which files to upload from the Select Files... option. 
5. Click Next to move on to the next step.
6. If your workspace uses any connections, the Upload Connections section will appear. You can select whether to publish the connections to FME Flow. 
7. Register Services is the last publishing step. Select the transformation services you want your workspace to be able to use on FME Flow. 
8. Click Publish
9. The translation log generates a summary of publishing and provides a direct link to open the workspace on FME Flow. 
For more information on the FME Flow services and publishing to FME Flow, see Deploy Workspaces on FME Flow

7) Run Workspace on FME Flow

Open the Run Workspace page on FME Flow and select the workspace you just published. Set the service to Data Download. The result will contain the list of addresses to notify about construction in the format of your choice. 

Under User Parameters, click the map icon for the Select Construction Area parameter. 

The geometry parameter web map appears. It shows the area specified in the user parameter settings in FME Workbench and offers options along the top to select which geometry type you wish to input.

Zoom into an area like downtown Vancouver, use the polygon tool to pick an area, and click Confirm to close the map. 

Note

To close an area in a polygon, click on the starting point to complete the shape.
For this workspace to run correctly, you need to select buildings with addresses. If you select an area without an address the workspace won’t write out any data. 

Confirm that GeoJSON coordinates are now present in the Select Construction Area parameter, and leave Microsoft Excel as the default output format. 

Click Run to run the workspace and wait for the Data Download URL. 

 8) Inspect Results

Once the workspace finishes running, click on the Data Download URL to download the data. 

Optionally, extract and open the data in FME Data Inspector. Now, Jennifer and her colleagues can use this workspace to generate a list of residents affected by the construction and send letters to them.

Viewing the resulting addresses in Microsoft Excel